#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int n, m;
int main()
{
	cin >> n >> m;
	if (n == 1) {
		if (m & 1)cout << m / 2 + 1 << endl;
		else cout << m / 2 + 1 << endl;
		return 0;
	}
	if (m == 1) {
		if (n & 1)cout << n / 2 + 1 << endl;
		else cout << n / 2 + 1 << endl;
		return 0;
	}
	if (n == m) {
		cout << n << endl;
	}
	else {
		int t = abs(n - m);
		if (t & 1)cout << min(n, m) + t / 2 + 1 << endl;
		else cout << min(n, m) + t / 2 << endl;
		//cout << min(n, m) + abs(n-m) << endl;
	}
	return 0;
}